package com.leoman.post.dao;

import com.leoman.common.dao.IBaseJpaRepository;
import com.leoman.post.entity.CommentPraise;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

/**
 * 评论点赞信息dao
 * Created by 涂奕恒 on 2016/6/12.
 */
public interface CommentPraiseDao extends IBaseJpaRepository<CommentPraise> {

    @Query("select a from CommentPraise a where a.commentId = ?1 and a.userInfo.id = ?2 and a.type = ?3 and a.isDetail = ?4")
    CommentPraise findOneByParams(Long commentId, Long userId, Integer type, Integer isDetail);

    @Query("select a from CommentPraise a where a.commentId = ?1 and a.type = ?2 and a.isDetail = ?3")
    List<CommentPraise> findListByParams(Long commentId, Integer type, Integer isDetail);
}
